// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: 'cloud-dev-alpha-3f1k3'
})
const db = cloud.database()

// 云函数入口函数
exports.main = async (event, context) => {
  console.log(event)
  var usrCards = new Array()
  for(var i = 0; i < event.cardsID.length; i++){
    let result = await(db.collection('card').where({
        cardID: event.cardsID[i].cardID
      }).get({
        success: res=>{
        console.log("查询成功！")
        },
        fail: res=>{
          console.log("查询失败！！！")
        }
      })
    )
    usrCards.push(result.data[0])
  }
  return usrCards 
}